#!/usr/bin/env perl
use Image::ExifTool qw(ImageInfo);
my $info;
my $file = shift or die "Please specify filename";
my $exifTool = new Image::ExifTool;
$exifTool->Options(Unknown => 1, DateFormat => '%Y-%m-%dT%H:%M:%S', List => 1, PrintConv => 0);
$info = $exifTool->ImageInfo($file);
foreach my $tag (keys %$info) {
    my $group0 = $exifTool->GetGroup($tag, 0);
    my $group1 = $exifTool->GetGroup($tag, 1);
    my $category = $exifTool->GetGroup($tag, 2);
    my $tagId = $exifTool->GetTagID($tag);
    my $val = $$info{$tag};
    if (ref $val eq 'ARRAY') {
        foreach my $v (@$val) {
    	    printf("%s,%s,%s,%s,%s:%s\n",$group0, $group1,$category,$tagId,$tag,$v);
        }
    } elsif (ref $val eq 'SCALAR') {
    } else {
        printf("%s,%s,%s,%s,%s:%s\n",$group0, $group1,$category,$tagId,$tag,$val);
    }
}
